package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.RulesetMapper;
import com.huasan.www.demon.data.service.RulesetService;

import com.huasan.www.demon.pojo.Ruleset;
import com.huasan.www.demon.pojo.RulesetExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("rulesetService")
public class RulesetServiceImpl implements RulesetService{
	
    @Autowired
    private RulesetMapper rulesetDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int countByExample(RulesetExample example){
      return rulesetDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByExample(RulesetExample example){
      return rulesetDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insert(Ruleset record){
      return rulesetDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insertSelective(Ruleset record){
      return rulesetDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public List<Ruleset> selectByExample(RulesetExample example){
      return rulesetDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExampleSelective(@Param("record") Ruleset record, @Param("example") RulesetExample example){
      return rulesetDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ruleset
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExample(@Param("record") Ruleset record, @Param("example") RulesetExample example){
      return rulesetDao.updateByExample(record,example);
    }

    public OnePage<Ruleset> selectOnePageByExample(RulesetExample example){
    	int count = rulesetDao.countByExample(example);
    	List<Ruleset> dataList = rulesetDao.selectByExample(example);
    	OnePage<Ruleset> onepage = new OnePage<Ruleset>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}